package myThread;

public class Desk {
    // 定义一个标记
    // 若为true有资源，调用消费者线程
    // false无资源，调用生产者线程
    // public static boolean flag = false;
    private boolean flag;

    //public static int count = 10; // 定义最多生产和消费的资源数量
    private int count = 10;

    private final Object lock = new Object();// 锁对象

    public Desk() {
        this(false, 10);
    }

    public Desk(boolean flag, int count) {
        this.flag = flag;
        this.count = count;
    }

    public boolean isFlag() {
        return flag;
    }

    public void setFlag(boolean flag) {
        this.flag = flag;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public Object getLock() {
        return lock;
    }

    @Override
    public String toString() {
        return "Desk{" +
                "flag=" + flag +
                ", count=" + count +
                '}';
    }
}
